<template>
    <div v-if="Object.keys(goods).length !==0" class="base-info">
        <div class="info-title">{{goods.title}}</div>
        <div class="info-price">
            <span class="n-price">{{goods.newPrice}}</span>
            <span class="o-price">{{goods.oldPrice}}</span>
            <span class="discount" v-if="goods.discount">{{goods.discount}}</span>
        </div>
        <div class="info-other">
            <span>{{goods.columns[0]}}</span>
            <span>{{goods.columns[1]}}</span>
            <span>{{goods.services[goods.services.length-1].name}}</span>
        </div>
        <div class="info-service">
            <span class="info-services-item" 
                v-for="index in goods.services.length" 
                :key="index">
                <img :src="goods.services[index-1].icon" >
                <span>{{goods.services[index-1].name}}</span>
            </span>
        </div>
    </div>
</template>
<script>
export default {
   name:'DetailBaseInfo',
    props: {
        goods:{
            type:Object,
            default(){
                return {}
            }
        }
    },
}
</script>

<style scoped>
 .base-info{
     margin-top: 15px;
     color: #999;
     padding: 5px;
     border-bottom: 1px solid #f2f5f8;   
    }
    .info-title{
        color: #222;
        font-size:16px;
    }
    .info-price{
        margin-top: 10px;
        padding-left: 5px;
    }
    .info-price .n-price{
        font-size: 24px;
        color: var(--color-high-text);
    }
    .info-price .o-price{
        font-size: 13px;
        margin-left: 5px;
        padding-left: 5px;
        padding-right: 15px;
        text-decoration: line-through;
    }
    .info-price .discount{
        font-size: 12px;
        padding: 3px 7px;
        border-radius: 8px;
        color: #fff; 
        background-color: palevioletred;
    }
    .info-other{
        margin-top: 15px;
        line-height: 30px;
        font-size: 13px;
        display: flex;
        border-bottom: 1px solid rgba(100, 100, 100,.1);
        
    }
    .info-other span{
        padding-left: 10px;
        flex: 1;
    }
    .info-service{
        display: flex;
        line-height: 60px;
        
    }
    .info-services-item{
        flex: 1;
        font-size:1.5vw;
        margin-left:5px; 
    }
    .info-services-item img{
       width: 14px;
       height: 14px;
       position: relative;
       top: 2px;
    }
    .info-service span{
        color: #333;
    }
</style>